<%@ page language="java"
	import="java.util.*,edu.cnu.tpts.bean.*,edu.cnu.tpts.dao.*,edu.cnu.tpts.dao.impl.*"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/authorize.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



<html>
<head>
	<base href="<%=basePath%>">
    <title>admin</title>
    <link rel="stylesheet" type="text/css" href="/css/main.css">
</head>
<body>
<div id="header">

</div>

<div id="menu">
    <ul>
    
        <li><a hidefocus="hidefocus" href="student/showMessage.jsp">查询个人信息</a></li>         
         <li><a hidefocus="hidefocus" href="student/updateMessage.jsp">更新个人信息</a></li>
        <li><a hidefocus="hidefocus" href="student/showScore.jsp">查询个人成绩</a></li>
        <li><a hidefocus="hidefocus" href="student/showTeacher.jsp">查询教师信息</a></li>
      <li><a hidefocus="hidefocus" href="student/predict.jsp">成绩和能力预测</a></li>
        <li><a hidefocus="hidefocus" href="student/alarm.jsp">查看预警信息</a></li>
         <li><a hidefocus="hidefocus" href="quit.jsp">退出</a></li>
        	 <%@include file="/WEB-INF/date.jsp"%>
         
     </ul>
 
</div>

<div class="table">

        <%
    String type=(String)session.getAttribute("type");
    StudentDao stuDao =new StudentDaoImpl();    
    Student stu=null;
    if(type.equals("student")){     //学生更新自己的信息
     	
    	Student sstu=(Student)session.getAttribute("user");
    	stu=stuDao.findById(sstu.getId());
    }else{ //管理员更新学生信息
       int stuid=Integer.parseInt(request.getParameter("stuid"));
    	stu=stuDao.findById(stuid);
    }
  
    
     %>
     <form action="student/doupdateMessage.jsp" method="post"  >      
     <table>
     	<tr>
     		<td>学号</td>
     		<td><input type="text" name="id" value="<%=stu.getId() %>" readonly></td>
     	</tr>
     	<tr>
     		<td>登录名</td>
     		<td><input type="text" name="loginname" value="<%=stu.getLoginName() %>" >#</td>
     	</tr>
     	<tr>
     		<td>用户姓名</td>
     		<td><input type="text" name="realname" value="<%=stu.getRealName() %>" readonly></td>
     	</tr>
     	<tr>
     		<td>密码</td>
     		<td><input type="password" name="password"  >#</td>
     	</tr>
     	<tr>
     		<td>确认密码</td>
     		<td><input type="password" name="repassword" >#
     		<span><%
     		String error=(String)request.getAttribute("error");
     		if(error!=null)  out.print(error);
     		 %>
     		
     		 </span></td>
     	</tr>
     	<tr>
     		<td>性别</td>
     		<td><input type="text" name="sex" value="<%=stu.getSex() %>" readonly></td>
     	</tr>
     	<tr>
     		<td>所在院系</td>
     		<td><input type="text" name="stu_department" value="<%=stu.getStuDepartment() %>" readonly></td>
     	</tr>
     	<tr>
     		<td>所在班级</td>
     		<td><input type="text" name="stu_class" value="<%=stu.getStuClass() %> " readonly></td>
     	</tr>   
     	<tr>
     		<td colspan="2"><input type="submit" value="提交"/></td>
     	
     	</tr>  
     </table>
     </form>

</div>

<div id="copyright">
    <div align="center">
        <font face="Tahoma, Verdana" color="#ffffff">Copyright &copy; 首都师范大学版权所有<br>

            地址：北京市西三环北路105号 100048&nbsp;&nbsp;&nbsp;&nbsp; E-mail: </font><font face="Tahoma, Verdana">

    </font>
    </div>

</div>

</body>
</html>